<?php
class SiteController extends Controller{


    function IndexAction(){
        $post = new Post;
        $pagesize = 2;
        $page = isset($this->params['page'])?intval($this->params['page']):1;
		$where = array();
		$order = 'created desc';
		$limit = $pagesize;
		$offset = ($page-1)*$pagesize;
        $postlist = $post -> getAllPost($where, $order, $limit, $offset);
        $total = $postlist['total'];
        unset($postlist['total']);
        $pagination = new Mpagination($page,$pagesize,$total,$this->createUrl('site/index'));
        $this->render('index',array('postlist'=>$postlist,'pagination'=>$pagination));
    }


}